/**
 * 
 */
package steffens.java.gui.defaultui.interactive.buttons.eventbased;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Icon;

import steffens.java.gui.defaultui.interactive.events.buttons.DeclineEvent;
import steffens.java.gui.defaultui.interactive.listener.ButtonEventListener;

/**
 * @author Steffen Baumann
 * @version 1.0 
 *
 */
public class DeclineButton extends DefaultEventButton implements ActionListener{

	/** */
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 */
	public DeclineButton() {
		this("OK", DEFAULT_ICON, DEFAULT_SIZE);
	}

	/**
	 * @param text
	 */
	public DeclineButton(String text) {
		this(text, DEFAULT_ICON, DEFAULT_SIZE);
	}
	
	/**
	 * @param icon
	 */
	public DeclineButton(Icon icon) {
		this(DEFAULT_TEXT, icon, DEFAULT_SIZE);
	}
	
	/**
	 * @param size
	 */
	public DeclineButton(Dimension size) {
		this(DEFAULT_TEXT, DEFAULT_ICON, size);
	}
	
	/**
	 * @param text
	 * @param icon
	 * @param size
	 */
	public DeclineButton(String text, Icon icon, Dimension size) {
		super(text, icon, size);
		this.addActionListener(this);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource().equals(this)){
			for(ButtonEventListener listener : getButtonEventListeners()){
				listener.firedEvent(new DeclineEvent());	
			}
		}
	}
	
}
